/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2016 pjoc.pub, blademainer.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *
 */

package pub.pjoc.pay.pojo;

import java.util.Objects;

/**
 * Success pay order.
 *
 * @author blademainer
 * @version 2016-10-24 22:39
 */
public class PayOrderOk extends BasePayOrder {
  /**
   * The time that this order succeed.<p></p>
   * Format: yyyy-MM-dd HH:mm:ss
   */
  private String successTime;

  /**
   * The date this order succeed.
   * Format: yyyy-MM-dd
   */
  private String balanceDate;

  /**
   * Net amount of this order.
   */
  private Integer netAmount;

  /**
   * Fee amount of this order.<p></p>
   * FeeAmount = Amount - NetAmount;
   */
  private Integer feeAmount;

  public String getSuccessTime() {
    return successTime;
  }

  public void setSuccessTime(String successTime) {
    this.successTime = successTime;
  }

  public String getBalanceDate() {
    return balanceDate;
  }

  public void setBalanceDate(String balanceDate) {
    this.balanceDate = balanceDate;
  }

  public Integer getNetAmount() {
    return netAmount;
  }

  public void setNetAmount(Integer netAmount) {
    this.netAmount = netAmount;
  }

  public Integer getFeeAmount() {
    return feeAmount;
  }

  public void setFeeAmount(Integer feeAmount) {
    this.feeAmount = feeAmount;
  }

  @Override
  public String toString() {
    return "PayOrderOk{" +
        "successTime='" + successTime + '\'' +
        ", balanceDate='" + balanceDate + '\'' +
        ", netAmount=" + netAmount +
        ", feeAmount=" + feeAmount +
        "} " + super.toString();
  }

  @Override
  public boolean equal(Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof PayOrderOk)) {
      return false;
    }
    PayOrderOk that = (PayOrderOk) o;
    return Objects.equals(netAmount, that.netAmount) &&
        Objects.equals(feeAmount, that.feeAmount) &&
        Objects.equals(successTime, that.successTime) &&
        Objects.equals(balanceDate, that.balanceDate);
  }

  @Override
  public int hash() {
    return Objects.hash(successTime, balanceDate, netAmount, feeAmount);
  }
}
